﻿package  com.hadron.mp3player
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author Hadron
	 */
	public class Preloader extends Sprite
	{
		
		public function Preloader() 
		{
			var preloader:MovieClip = new circle_mc();
			addChild(preloader);
			addEventListener(Event.ADDED_TO_STAGE, onAdded, false, 0, true);
		}
		
		private function onAdded(e:Event):void
		{
			//trace(e);
			addEventListener(Event.ENTER_FRAME, onEnterFrame, false, 0, true);
			addEventListener(Event.REMOVED_FROM_STAGE, onRemoved, false, 0, true);
			removeEventListener(Event.ADDED_TO_STAGE, onAdded);
		}
		
		private function onEnterFrame(e:Event):void
		{
			getChildAt(0).rotation += 17;
		}		
		
		private function onRemoved(e:Event):void
		{
			addEventListener(Event.ADDED_TO_STAGE, onAdded, false, 0, true);
			removeEventListener(Event.ENTER_FRAME, onEnterFrame);
			removeEventListener(Event.REMOVED_FROM_STAGE, onRemoved);
		}
	}
}